package org.example.iol;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class TextReaderAndWriter {
    public static void main(String[] args) throws IOException {
//        Writer writer = new FileWriter("E:/zzz.txt");
//        writer.write("希克斯十九点是库存"); //覆盖文件内容
//        writer.flush();
//        writer.close();
        //创建字符输入流
        FileReader reader = new FileReader("E:/newFile.txt");
        //读取文件内容
//        int read = reader.read();
//        System.out.println((char) read);
        //循环输出全部内容
        char[] chars = new char[1024];
        while (reader.read(chars)!=-1){
            System.out.println(new String(chars));
        }
        reader.close();
    }
}
